package com.ytjj.qmyx.mall.utils;

import com.ytjj.common.api.ResultCode;

public class ApiResult {
	
	public static Boolean RESULT_SUCCESS=true;
	public static Boolean RESULT_FAIL=false;
	
	private Boolean success;
	private Object data;
	private long code;
	private String msg;

	public ApiResult() {
		super();
	}


	public static ApiResult success(Object data) {
		return new ApiResult(RESULT_SUCCESS,data, ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMessage());
	}


	public static ApiResult success(Object data,String msg) {
		return new ApiResult(RESULT_SUCCESS,data,ResultCode.SUCCESS.getCode(),msg);
	}

	public static ApiResult failure(String msg) {
		return new ApiResult(RESULT_FAIL,(Object)null,ResultCode.FAILED.getCode(),msg);
	}

	public static ApiResult failure(long code, String msg) {
		return new ApiResult(RESULT_FAIL,(Object)null,code,msg);
	}

	public static ApiResult failure(Object data,long code, String msg) {
		return new ApiResult(RESULT_FAIL,data,code,msg);
	}

	public ApiResult(boolean success, Object data, long code, String msg) {
		super();
		this.success = success;
		this.data = new ReData(data);
		this.code = code;
		this.msg = msg;
	}

	public class ReData {
		private Object data;

		public ReData(Object data) {
			this.data = data;
		}

		public Object getData() {
			return data;
		}

		public void setData(Object data) {
			this.data = data;
		}
	}

	public Boolean getSuccess() {
		return success;
	}

	public void setSuccess(Boolean success) {
		this.success = success;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public long getCode() {
		return code;
	}

	public void setCode(Integer errorcode) {
		this.code = errorcode;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

}
